<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>方法事件处理器</title>
    <script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>

    <div id="example-2">
        <button v-on:click="greet">Greet</button>
    </div>

    <script>

        new Vue({
            el:'#example-2',
            data:{
                name:'Vue.js'
            },
            methods:{
                greet:function (event) {
                    alert('Hello'+this.name+"!")
                    if(event){
                        alert(event.target.tagName)
                    }
                }
            }
        })
    </script>
</body>
</html>